package com.atguigu.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * redisson配置
 *
 * @author LaiSanShan
 * @date 2021-08-10
 */
@Configuration
public class MyRedissonConfig {

    @Bean(destroyMethod = "shutdown")
    RedissonClient redisson() {
        //1、创建配置
        Config config = new Config();
        config.useSingleServer().setAddress("redis://192.168.78.128:6379");

        //2、根据Config创建出RedissonClient实例
        return Redisson.create(config);
    }

}
